﻿using RestSharp;
using System;
using System.Web;
using Ymatou.ServiceCenter;
using Ymatou.User.Dto.Auth;
using YmtAuth.AppService;
using YmtAuth.AppService.JavaService;
using YmtAuth.Domain.Shard;
using YmtSystem.CrossCutting;
using ResetService = ServiceStack.Service;

namespace YmtAuth.Web.Handlerv2
{
    
    public class LoginAuthHandler : ResetService
    {
        private IAuthAppService AuthAppService { get { return LocalServiceLocator.GetService<IAuthAppService>(); } }

//        [ServiceRegister("/json/reply/LoginAuthRequestDto", Method.POST)]
//        public object Post(LoginAuthRequestDto request)
//        {
//            return AuthAppService.LoginAuth(request.LoginId, request.Pas, request.Description, request.ClientIp);
//        }
           //java
        [ServiceRegister("/json/reply/LoginAuthRequestDto", Method.GET)]
        public object Get(LoginAuthRequestDto request)
        {
            //JsConfig.IncludeNullValues = true;   
          
            HttpContext.Current.Request.Headers.Add(YmtUserKey.RequestId, Guid.NewGuid().ToString("N"));
            HttpContext.Current.Request.Headers.Add(YmtAuthSafeConstant.ApiId, YmtAuthSafeConstant.Api_login);
            return AuthAppService.LoginAuth2(request,Request);
        }
    }
}